package edu.uta.cse6339.facetedinterface.util;

import java.util.HashMap;
import java.util.Set;

public class UniversityVlntCrimeRangeValues {


	private static final String UniverysityVlntCrimeRangeFile ="src/edu/uta/cse6339/facetedinterface/resources/UniverysityVlntCrimeRange";
	
	private static HashMap<Integer,Set<String>> univerysityRange = null;
	private static Integer univerysityRangeKey [] = null;
	
	private static int MAX_RANGE_VALUE=70;
	private static int MIN_RANGE_VALUE=10;
	
	private UniversityVlntCrimeRangeValues(){
		
	}
	
	
	public static void initialiseRange(){
		univerysityRange =ProcessRange.readRangeFile(UniverysityVlntCrimeRangeFile);
		univerysityRangeKey=ProcessRange.sortRangeKeyValues(univerysityRange);
	}
	
	
	public static Set<String> getRangeValues(int value){
		int rangeKey=0;
		Set<String> states=null;
	    float newValue = (((float)value)/(100))*(MAX_RANGE_VALUE);
		if(univerysityRangeKey!=null && univerysityRangeKey.length>0){
			for(Integer key : univerysityRangeKey){
				rangeKey =key;
				if(key>=(int)newValue){
					break;
				}		
			}
			states=univerysityRange.get(rangeKey);
		}
		return states;
	}

	
	public static void main(String args[]){
		initialiseRange();
		System.out.println(getRangeValues(30));
	}


}
